﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AutoMapper;

namespace HCQ2_Model.ClassRoom
{
    /// <summary>
    /// 创建直播课堂
    /// </summary>
    public class ClassRoomCreateDto
    {
        /// <summary>
        /// 【必填】课件信息
        /// </summary>
        [Required(ErrorMessage = "课件信息必填")]
        public List<FileDocument> FileInfo { get; set; }

        /// <summary>
        /// 【必填】用户ID
        /// </summary>
        [Required(ErrorMessage = "用户ID必填")]
        [IgnoreMap]
        public string userid { get; set; }
        /// <summary>
        /// 【必填】目录ID
        /// </summary>
        /// <remarks>
        /// 说明：虚仿课程ID
        /// </remarks>
        [Required(ErrorMessage = "目录ID必填")]
        public int? FolderId { get; set; }
        /// <summary>
        /// 【必填】课堂名称
        /// </summary>
        [Required(ErrorMessage = "课堂名称必填")]
        public string CrName { get; set; }
        /// <summary>
        /// 【必填】上课时间
        /// </summary>
        [Required(ErrorMessage = "上课时间必填")]
        public DateTime? StartTime { get; set; }
        /// <summary>
        /// 【必填】时长，单位：分钟
        /// </summary>
        [Required(ErrorMessage = "时长必填")]
        public int? StartLen { get; set; }
        /// <summary>
        /// 【必填】授课范围；1(局域网)、2(互联网)
        /// </summary>
        [Required(ErrorMessage = "授课范围必填")]
        [Range(1,2,ErrorMessage = "授课范围填写错误，应该是：1(局域网)、2(互联网)其中之一")]
        public int? Scope { get; set; }
        /// <summary>
        /// IP地址
        /// </summary>
        public string IP { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Note { get; set; }
        /// <summary>
        /// 价格
        /// </summary>
        public decimal Price { get; set; }
        /// <summary>
        /// 人数
        /// </summary>
        public int? PersonNumber { get; set; }
        /// <summary>
        /// 上课设备
        /// </summary>
        public int? Device { get; set; }
        /// <summary>
        /// 转换成N_VRLineClassRoom，不能使用帮助类的那个，由于配置
        /// </summary>
        /// <returns></returns>
        public N_VRLineClassRoom ThisMapTo() {
            Mapper.CreateMap(this.GetType(), typeof(N_VRLineClassRoom)).ForMember("UserId", opt => opt.Ignore());
            return Mapper.Map<N_VRLineClassRoom>(this);
        }
    }

    /// <summary>
    /// 修改直播课堂
    /// </summary>
    public class ClassRoomUpdateDto : ClassRoomCreateDto
    { 
        /// <summary>
        /// 【必填】课堂ID
        /// </summary>
        [Required(ErrorMessage ="修改时课堂ID必填")]
        public int? RmId { get; set; }
    }

    /// <summary>
    /// 课件信息
    /// </summary>
    public class FileDocument
    {
        /// <summary>
        /// 【必填】课件ID
        /// </summary>
        [Required(ErrorMessage ="课件ID必填")]
        public int? FileId { get; set; }
        /// <summary>
        /// 【必填】是否默认启动课件
        /// </summary>
        [Required(ErrorMessage ="是否默认启动课件必填")]
        public bool? IfDefault { get; set; }
    }
}
